package core;

import parsing.ParsingTools;


public class City {

	int countryId;
	int cityId;
	float longtitude;
	float latitude;
	public String cityName;

	public City(String cityName, float latitude, float longtitude,
		String countryId, int cityId) {
		this.longtitude = longtitude;
		this.latitude = latitude;
		this.cityName = cityName;
		int countryID = ParsingTools.GetCountryIDFromCode(countryId);
		this.countryId = countryID;
		this.cityId = cityId;
	}

	// Construction for simulation
	public City(String cityName, float latitude, float longtitude,
		int countryID, int cityID) {
		this.longtitude = longtitude;
		this.latitude = latitude;
		this.cityName = cityName;
		this.countryId = countryID;
		this.cityId = cityID;
	}
	
	public City(String cityName, float latitude, float longtitude,
			int countryID) {

			this(cityName, latitude, longtitude,
					 countryID, -1);
		}

	public City(String cityName, float latitude , float longtitude,
			String countryId) {
		this.cityName=cityName;
		this.countryId=ParsingTools.GetCountryIDFromCode(countryId);
		this.longtitude=longtitude;
		this.latitude=latitude;
	}




	public int getCountryId() {
		return countryId;
	}

	public void setCountryId(int countryId) {
		this.countryId = countryId;
	}

	public int getCityId() {
		return cityId;
	}

	public void setCityId(int cityId) {
		this.cityId = cityId;
	}

	public float getLongtitude() {
		return longtitude;
	}

	public void setLongtitude(float longtitude) {
		this.longtitude = longtitude;
	}

	public float getLatitude() {
		return latitude;
	}

	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}


	@Override
	public boolean equals(Object obj) {
		if (obj == this) {
			return true;
		}
		if (!(obj instanceof City)) {
			return false;
		}
		City other = (City) obj;
		if ((this.cityName.equals(other.cityName)
						&& (this.countryId == other.countryId))) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		int hash = 17;
		hash = 37 * hash
				+ (this.cityName != null ? this.cityName.hashCode() : 0);
		hash = 37 * hash + this.countryId;
		return hash;
	}
}
